$(document).ready(
	function() {
		// alert("来源:"+document.referrer);
		// alert("当前:"+window.location.href);
		var referrer = document.referrer;
		var currenturl = window.location.href;
		var browser = getBrowserName();
		var screen=$(window).width()+"x"+$(window).height();
		//alert(browser);
		$.ajax({
			// alert(encodeURI(encodeURI(username)));中文乱码处理
			type : "post",
			contentType : "application/json",
			url : "/statistic.json?referrer=" + referrer + "&currenturl="+ currenturl+"&browser="+browser+"&screen="+screen,
			data : "{}",
			dataType : 'json',
			success : function(data) {
			}
		});
});
var ua = navigator.userAgent.toLowerCase();
function check(r) {
	return r.test(ua);
}
/**
 *  * return IE,IE6,IE7,IE8,IE9,Chrome,Firefox,Opera,WebKit,Safari,Others
 */
function getBrowserName() {
	var browserName;
	var isOpera = check(/opera/);
	var isChrome = check(/chrome/);
	var isFirefox = check(/firefox/);
	var isWebKit = check(/webkit/);
	var isSafari = !isChrome && check(/safari/);
	var isIE = !isOpera && check(/msie/);
	var isIE7 = isIE && check(/msie 7/);
	var isIE8 = isIE && check(/msie 8/);
	var isIE9 = isIE && check(/msie 9/);
	var isIE10 = isIE && check(/msie 10/);
	if (isIE10) {
		browserName = "IE10";
	} else if (isIE9) {
		browserName = "IE9";
	} else if (isIE8) {
		browserName = "IE8";
	} else if (isIE7) {
		browserName = "IE7";
	} else if (isIE) {
		browserName = "IE";
	} else if (isChrome) {
		browserName = "Chrome";
	} else if (isFirefox) {
		browserName = "Firefox";
	} else if (isOpera) {
		browserName = "Opera";
	} else if (isWebKit) {
		browserName = "WebKit";
	} else if (isSafari) {
		browserName = "Safari";
	} else {
		browserName = "Others";
	}
	return browserName;
}
